- content_for :javascript do
  initialize_admin_edit_tribe_look_and_feel_form("#{I18n.locale}", "#{@community.id}", "#{t('.invalid_color_code')}");

- content_for :title_header do
  %h1
    = t("layouts.admin.admin")
    = "-"
    = t("admin.communities.edit_details.community_look_and_feel")

= render partial: 'layouts/onboarding_popup_wrapper'
= render :partial => "admin/left_hand_navigation", :locals => { :links => admin_links_for(@current_community) }

#new_news_item_form.left-navi-section
  %h2= t(".edit_community_look_and_feel", :community_name => @community.name(I18n.locale))
  = form_for @community, :url => admin_look_and_feel_path, method: :patch do |form|
    .row
      .col-12
        - logo_old = ".logo_instructions_text_with_dimensions"
        - logo_no_placing = ".logo_instructions_text_with_dimensions_no_placing"
        - logo_info = FeatureFlagHelper.feature_enabled?(:topbar_v1) ? logo_no_placing : logo_old
        = form.label :wide_logo, t(".community_logo"), :class => "input"
        = render :partial => "layouts/info_text", :locals => { :text =>t(logo_info, :width => 336, :height => 80)}
        = render 'layouts/filename', file_field: @community.wide_logo
        = render 'attachment_destroy', file_field: @community.wide_logo, title: t(".community_logo")
        = form.file_field(:wide_logo, :class => "file_field")

    .row
      .col-12
        - icon_label = ".community_logo_icon_mobile"
        - icon_info = ".logo_mobile_icon_instructions_text_with_dimensions"
        = form.label :logo, t(icon_label), :class => "input"
        = render :partial => "layouts/info_text", :locals => { :text => t(icon_info, :width => 600, :height => 600)}
        = render 'layouts/filename', file_field: @community.logo
        = render 'attachment_destroy', file_field: @community.logo, title: t(icon_label)
        = form.file_field(:logo, :class => "file_field")

    .row
      .col-12
        = form.label :cover_photo, t(".community_cover_photo"), :class => "input"
        = render :partial => "layouts/info_text", :locals => { :text => (t(".cover_photo_visibility") + " " +  t(".cover_photo_instructions_text_with_dimensions", :width => 1920, :height => 450, :see_how_it_looks_like => link_to(t("admin.communities.edit_details.see_how_it_looks_like"), "/?big_cover_photo=true", :id => "view_cover_photo_link", :target => :_blank))).html_safe}
        - link = link_to t(".we_have_you_covered"), 'https://help.sharetribe.com/en/articles/666084', target: '_blank'
        = render :partial => "layouts/info_text", :locals => { :text => t(".cover_photo_ready_made", link: link).html_safe }

        = render 'layouts/filename', file_field: @community.cover_photo
        = render 'attachment_destroy', file_field: @community.cover_photo, title: t(".community_cover_photo")
        = form.file_field(:cover_photo, :class => "file_field")

    .row
      .col-12
        = form.label :small_cover_photo, t(".small_community_cover_photo"), :class => "input"
        = render :partial => "layouts/info_text", :locals => { :text => t(".small_cover_photo_visibility") + " " + t(".small_cover_photo_instructions_text_with_dimensions", :width => 1920, :height => 96) }
        = render :partial => "layouts/info_text", :locals => { :text => t(".main_content_width", :main_width => 1008)}
        = render 'layouts/filename', file_field: @community.small_cover_photo
        = render 'attachment_destroy', file_field: @community.small_cover_photo, title: t(".small_community_cover_photo")
        = form.file_field(:small_cover_photo, :class => "file_field")

    .row
      .col-12
        = form.label :favicon, t(".favicon"), :class => "input"
        = render :partial => "layouts/info_text", :locals => { :text => t(".favicon_info_text") }
        = render 'layouts/filename', file_field: @community.favicon
        = render 'attachment_destroy', file_field: @community.favicon, title: t(".favicon")
        = form.file_field(:favicon, :class => "file_field")

    .row
      .col-12
        = form.label :custom_color1, t(".community_custom_color1"), :class => "input"
        - link = link_to 'WebFX.com', 'https://www.webfx.com/web-design/color-picker/d96e21', target: '_blank', rel: "noreferrer"
        = render :partial => "layouts/info_text", :locals => { :text => t(".custom_color1_instructions_text", link: link).html_safe }
        = form.text_field :custom_color1, :maxlength => "6", :class => "text_field"

    .row
      .col-12
        = form.label :slogan_color, t("admin.communities.edit_look_and_feel.community_slogan_color"), :class => "input"
        = render :partial => "layouts/info_text", :locals => { :text => t("admin.communities.edit_look_and_feel.community_slogan_color_instructions_text", colorpicker: "<a href=\"http://www.colorpicker.com/?colorcode=D96E21\" target=\"_blank\" rel=\"noreferrer\">ColorPicker.com</a>", :see_how_it_looks_like => link_to(t("admin.communities.edit_details.see_how_it_looks_like"), "/?big_cover_photo=true", :id => "view_cover_photo_link", :target => :_blank)).html_safe }
        = form.text_field :slogan_color, :maxlength => "6", :class => "text_field"

    .row
      .col-12
        = form.label :description_color, t("admin.communities.edit_look_and_feel.community_description_color"), :class => "input"
        = render :partial => "layouts/info_text", :locals => { :text => t("admin.communities.edit_look_and_feel.community_description_color_instructions_text", colorpicker: "<a href=\"http://www.colorpicker.com/?colorcode=D96E21\" target=\"_blank\" rel=\"noreferrer\">ColorPicker.com</a>", :see_how_it_looks_like => link_to(t("admin.communities.edit_details.see_how_it_looks_like"), "/?big_cover_photo=true", :id => "view_cover_photo_link", :target => :_blank)).html_safe }
        = form.text_field :description_color, :maxlength => "6", :class => "text_field"


    - unless FeatureFlagHelper.feature_enabled?(:topbar_v1)
      .row
        .col-12
          - post_new_listing = "<i>#{t("homepage.index.post_new_listing")}</i>"
          = form.label :custom_color2, t(".new_listing_button_custom_color").html_safe, :class => "input"
          = render :partial => "layouts/info_text", :locals => { :text =>  t(".new_listing_button_instructions_text", link_to_colorpicker: link_to("ColorPicker.com", "http://www.colorpicker.com?colorcode=00a26c", target: "_blank", rel: "noreferrer")).html_safe }
          = form.text_field :custom_color2, :maxlength => "6", :class => "text_field"

    .row
      .col-12
        = form.label :default_browse_view, t(".default_browse_view")
        = render :partial => "layouts/info_text", :locals => { :text => t(".default_browse_view_instructions_text") }
        = form.select :default_browse_view,
          [[t(".grid"), "grid"], [t(".list"), "list"], [t(".map"), "map", {disabled: show_location? ? nil : "disabled"}]]

    .row
      .col-12
        = form.label :name_display_type, t(".name_display_type")
        = render :partial => "layouts/info_text", :locals => { :text => t(".name_display_type_instructions_text") }
        = form.select :name_display_type, [[t(".full_name"), "full_name"], [t(".first_name_with_initial"), "first_name_with_initial"], [t(".first_name_only"), "first_name_only"]]

    .row
      .col-12
        = form.label :custom_head_script, t(".custom_head_script")
        = render :partial => "layouts/info_text", :locals => { :text => t(".custom_head_script_instructions_text") }
        = form.text_area :custom_head_script, class: "text_area_code", placeholder: "<script src=\"http://example.com/customscript.js\"></script>"

    .row
      .col-12
        = form.button t("admin.communities.edit_details.update_information"), :id => "edit_community_button", :class => "send_button"

= render :partial => "people/help_texts", :collection => ["invite_only_help_text"], :as => :field
